package cn.com.checne.dao;

import cn.com.checne.util.PropertiesUtil;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.springframework.stereotype.Repository;

@Repository
public class SqlServerConnect {
	public static Connection getChecCNConnection() {
		Connection conn = null;
		try {
			Class.forName(PropertiesUtil.getChecDBDriver());
			conn = DriverManager.getConnection(
					PropertiesUtil.getChecDBConnectionURL(),
					PropertiesUtil.getChecDBUser(),
					PropertiesUtil.getChecDBPassword());
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return conn;
	}

	public static Connection getChecENConnection() {
		Connection conn = null;
		try {
			Class.forName(PropertiesUtil.getChecENDBDriver());
			conn = DriverManager.getConnection(
					PropertiesUtil.getChecENDBConnectionURL(),
					PropertiesUtil.getChecENDBUser(),
					PropertiesUtil.getChecENDBPassword());
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return conn;
	}
}